/**
 * 处理user 相关的操作
 */

import axios from '@/utils/request'

export const reqUserLogin = (mobile, code) => {
  return axios({
    method: 'POST',
    url: 'v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}

export const getUserInfo = () => {
  return axios({
    method: 'get',
    url: 'v1_0/user/profile'
  })
}

export const updateUserInfo = data => {
  return axios({
    method: 'patch',
    url: 'v1_0/user/profile',
    data
  })
}

export const updateUserAvatar = fd => {
  return axios({
    method: 'patch',
    url: 'v1_0/user/photo',
    data: fd
  })
}
